package com.aabte.feignhttp.demo.feign;

import com.aabte.feignhttp.demo.common.ResponseBean;
import com.aabte.feignhttp.demo.common.User;
import com.aabte.feignhttp.feignhttpclient.annotation.FeignHttpApi;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import org.springframework.stereotype.Component;

@FeignHttpApi(
        url = "${hello_url}",
        path = "${hello_path}"
)
@Component
public interface FeignService {

    // @GetMapping("/hello")
    // ResponseBean hello();

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /hello")
    ResponseBean hello();

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /user")
    ResponseBean user();

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /user/{name}")
    ResponseBean userByName1(@Param("name") String name);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("GET /user/url")
    ResponseBean userByName2(@Param("name") String name);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("POST /user")
    ResponseBean addUser(User user);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("PUT /user")
    ResponseBean updateUser(User user);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @RequestLine("DELETE /user/{id}")
    ResponseBean deleteUser(@Param("id") Integer id);


}
